package com.huanying.goodjob.community;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="community")
public class Community implements Serializable {

	private static final long serialVersionUID = 751709341756744315L;
	/**
	 * @Entity 表示当前为实体类
	 * @Id 主键
	 * @GeneratedValue(strategy=GenerationType.UUID) 主键生成策略。 @Column
	 *                                               映射字段的定义，包括映射的数据库表的字段名称。
	 *                                               是否允许为空。字段长度等等定义。
	 * 
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;
	private String name; // 小区名字

	@OneToOne(cascade = CascadeType.REFRESH, optional = true)
	@JoinColumn(name = "city_code")
	private Area city;  //城市

	@OneToOne(cascade = CascadeType.REFRESH, optional = true)
	@JoinColumn(name = "province_code")
	private Area province;
	@OneToOne(cascade = CascadeType.REFRESH, optional = true)
	@JoinColumn(name = "county_code")
	private Area county; // 县或区
	@Column(name = "status", nullable = false, columnDefinition = "INT default 1")
	private int status;  //状态

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Area getCity() {
		return city;
	}

	public void setCity(Area city) {
		this.city = city;
	}

	public Area getProvince() {
		return province;
	}

	public void setProvince(Area province) {
		this.province = province;
	}

	public Area getCounty() {
		return county;
	}

	public void setCounty(Area county) {
		this.county = county;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
}
